package com.jms.product.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.jms.product.entity.UserBaseEntity;
import com.jms.product.service.UserBaseService;
import com.jms.common.utils.PageUtils;
import com.jms.common.utils.R;



/**
 * 用户基础信息表
 *
 * @author Jamison
 * @email 2982935350@qq.com
 * @date 2021-06-13 22:41:16
 */
@RestController
@RequestMapping("product/userbase")
public class UserBaseController {
    @Autowired
    private UserBaseService userBaseService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userBaseService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{uid}")
    public R info(@PathVariable("uid") Long uid){
		UserBaseEntity userBase = userBaseService.getById(uid);

        return R.ok().put("userBase", userBase);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody UserBaseEntity userBase){
		userBaseService.save(userBase);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserBaseEntity userBase){
		userBaseService.updateById(userBase);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] uids){
		userBaseService.removeByIds(Arrays.asList(uids));

        return R.ok();
    }

}
